-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8353230: Emoji rendering regression after JDK-8208377 #24412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back dgredler! A progress list of the required criteria for merging this PR into |
❗ This change is not yet ready to be integrated. |
We had similar emoji-related regressions at JetBrains. Although our font-related code diverged from OpenJDK a bit, porting this patch seems to resolve them too. I am not an OpenJDK reviewer, but LGTM nevertheless. |
By the way, I see that in each implementation, both |
@YaaZ: Thanks for the additional feedback, please see my thoughts below:
I don't know if I would call two changes to
True, but again keep in mind that there are only 5 implementations, only one of which (the macOS
We'd still need separate methods for
I prefer to think of it as controlling whether or not any transformations to Any ideas for what this refactoring might look like? |
I was talking about the explosion because there is a scenario in my mind, which I didn't make clear for everybody else. There is a change which I didn't have time to contribute, but would like to: it's related to composite fonts and variation selectors. We may need 2 variants for retrieving a glyph with a variation selector - one strictly matching a variation selector and another with a fallback to the base glyph, multiplied by raw/transformed versions, which adds 2 more methods. Not like it's a big problem, but given that they all end up calling a single method anyway... You get the point.
Are those scenarios specific to a patricular mapper/font type? I was thinking that those transformations are generic.
I was thinking about moving this default-ignorable or any potential generic transformation into base |
It looks like this regression actually fits into a longer series of fixes / regressions in this area:
We have two different types of use cases pulling
CharToGlyphMapper
in two different directions: the users who need raw, untransformed glyph info, and the users who need normalized / transformed glyph info.It looks to me like, in the current code base, the only
CharToGlyphMapper
user which requires raw font data is HarfBuzz (explicitly confirmed with the HarfBuzz team here: harfbuzz/harfbuzz#5234).The regression mechanism at play here is that the HarfBuzz font callbacks are currently providing HarfBuzz with transformed glyph info (e.g. ZWJ -> INVISIBLE_GLYPH_ID), which prevents HarfBuzz from recognizing and applying the correct font GSUB substitutions (which involve ZWJ).
In order to fix this without (yet again) breaking metrics and display behavior elsewhere, I've added two methods to
CharToGlyphMapper
which provide access to raw glyph info, to be used by the HarfBuzz font callbacks:charToGlyphRaw(int)
andcharToVariationGlyphRaw(int)
.Note two intricacies related to
CompositeGlyphMapper
:CompositeGlyphMapper.SLOTMASK
to check glyph slots (e.g.FontRunIterator
andCTextPipe
) will "see" invisible glyphs as having come from slot 0. This isn't new, and I think it's OK, but something to be aware of.The glyph cache handling in
CCharToGlyphMapper
(for macOS) also requires care to avoid mixing value types.Please also note that I'm not sure if the tweak to
sunFont.c
is being tested, since FFM is being used by default for HarfBuzz integration. (Is there a plan to remove the JNI version soon?)This PR includes a self-contained regression test. It includes a small font created just for this test, which exercises the ligature / glyph substitution infrastructure. The font tests, including the new regression test, all pass locally on Linux, Windows and macOS (
make test TEST="jtreg:test/jdk/java/awt/font"
).Interestingly, the changes for JDK-7017058 (mentioned above) included a test (
ZWJLigatureTest
) which I think would have caught this last regression, but it depends on optional Windows fonts which I guess do not exist on any commonly-used test infrastructure. This should not be an issue with the new test, since it does not depend on any external fonts.Progress
Issue
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24412/head:pull/24412
$ git checkout pull/24412
Update a local copy of the PR:
$ git checkout pull/24412
$ git pull https://git.openjdk.org/jdk.git pull/24412/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 24412
View PR using the GUI difftool:
$ git pr show -t 24412
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24412.diff
Using Webrev
Link to Webrev Comment